package aom.ju.ss.view.user.userOrder

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentPagerAdapter
import aom.ju.ss.R
import aom.ju.ss.databinding.UserOrderListActivityBinding
import aom.ju.ss.view.base.BaseActivity
import aom.ju.ss.view.dicker.BarterGoods
import com.google.android.material.tabs.TabLayout

class UserOrderListActivity : BaseActivity() {
    private lateinit var binding: UserOrderListActivityBinding

    val fs = arrayListOf<UserOrderFragment>()
    val ts = arrayListOf("全部", "待支付", "待发货", "待签收", "待评论","退款/售后")
    override fun init() {
        binding = viewBinding as UserOrderListActivityBinding

        initGoods()
    }

    private fun initGoods() {
        fs.add(UserOrderFragment.getMys(""))
        fs.add(UserOrderFragment.getMys("1"))
        fs.add(UserOrderFragment.getMys("2"))
        fs.add(UserOrderFragment.getMys("3"))
        fs.add(UserOrderFragment.getMys("4"))
        fs.add(UserOrderFragment.getMys("5"))
        binding.vp.adapter = object : FragmentPagerAdapter(supportFragmentManager, 1) {
            override fun getCount(): Int {
                return fs.size
            }

            override fun getItem(position: Int): Fragment {
                return if (fs[position] == null) Fragment() else fs[position]!!
            }

            override fun getPageTitle(position: Int): CharSequence {
                return ts[position]
            }
        }
        binding.tab.setupWithViewPager(binding.vp)


    }

    override val lay: Int = R.layout.user_order_list_activity
}